home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-01 | 11.9 KB | 724 lines | [TEXT/CWIE] |
- // ix/iy + EXX: use HL (( fMSX; xz80 ))
- // ix/iy + EX DE,HL: use HL (( fMSX; xz80 ))
- // ix/iy + EX (SP),HL: use ix/iy (( fMSX; xz80 ))
- // ix/iy + JP (HL): use ix/iy (( fMSX; xz80; Z80 ))
- // ix/iy + PUSH HL: use ix/iy (( fMSX; xz80; Z80 ))
- // ix/iy + POP HL: use ix/iy (( fMSX; xz80; Z80 ))
- // ix/iy + ADD HL,BC: use ix/iy ?
- // ix/iy + ADD HL,DE: use ix/iy ?
- // ix/iy + ADD HL,HL: use ix/iy ?
- // ix/iy + ADD HL,SP: use ix/iy ?
- // ix/iy + LD SP,HL: use ix/iy ?
-
-
- // ----- ix/iy Command Dispatcher ----------------------------------------------------------------
-
-
- // ----- Handle ix prefixed command --------------------------------------------------------------
- cmd_IX: lea IX,ai // ai -> ix / iy
- bra.s cmd_XY
-
-
- // ----- Handle iy prefixed command --------------------------------------------------------------
- cmd_IY: lea IY,ai // ai -> ix / iy
- cmd_XY: move.b (ip)+,db
-
-
- // ----- debugger related testings
- #if CMD_PROFILE || cmd_firstuse
- movea.l cnt_xy,a0
- // addq.l #1,(a0,db.l*4)
- lsl #2,db
- addq.l #1,(a0,db.l)
- lsr #2,db
- #if cmd_firstuse
- bne.s cmdxy2
- move.l ai,-(a7) // save ai -> ix / iy
- }; Do_1st_Instr ( ip-2 ); asm {
- move.l (a7)+,ai // reload ai -> ix / iy
- cmdxy2:
- #endif
- #endif
-
-
- // ----- increment r register -----------------------------------
- #if EXACT_R
- addq.b #1,r
- #endif
-
-
- // ----- execute instruction -------------------------------------
- dc.w 0x41FB, 0x4A06 // lea *+$08(D4.l*2),A0
- adda.w (a0),a0
- jmp (a0)
-
-
- xy_tab: dc.w XYNOP, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP
- dc.w XYNOP, xy09, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP
- dc.w XYNOP, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP
- dc.w XYNOP, xy25, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP
- dc.w XYNOP, xy33, xy34, xy35, xy36, xy37, xy38, XYNOP
- dc.w XYNOP, xy41, xy42, xy43, xy44, xy45, xy46, XYNOP
- dc.w XYNOP, XYNOP, XYNOP, XYNOP, xy52, xy53, xy54, XYNOP
- dc.w XYNOP, xy57, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP
-
- dc.w XYNOP, XYNOP, XYNOP, XYNOP, xy68, xy69, xy70, XYNOP
- dc.w XYNOP, XYNOP, XYNOP, XYNOP, xy76, xy77, xy78, XYNOP
- dc.w XYNOP, XYNOP, XYNOP, XYNOP, xy84, xy85, xy86, XYNOP
- dc.w XYNOP, XYNOP, XYNOP, XYNOP, xy92, xy93, xy94, XYNOP
- dc.w xy96, xy97, xy98, xy99, xy100, xy101, xy102, xy103
- dc.w xy104, xy105, xy106, xy107, xy108, xy109, xy110, xy111
- dc.w xy112, xy113, xy114, xy115, xy116, xy117, XYNOP, xy119
- dc.w XYNOP, XYNOP, XYNOP, XYNOP, xy124, xy125, xy126, XYNOP
-
- dc.w XYNOP, XYNOP, XYNOP, XYNOP, xy132, xy133, xy134, XYNOP
- dc.w XYNOP, XYNOP, XYNOP, XYNOP, xy140, xy141, xy142, XYNOP
- dc.w XYNOP, XYNOP, XYNOP, XYNOP, xy148, xy149, xy150, XYNOP
- dc.w XYNOP, XYNOP, XYNOP, XYNOP, xy156, xy157, xy158, XYNOP
- dc.w XYNOP, XYNOP, XYNOP, XYNOP, xy164, xy165, xy166, XYNOP
- dc.w XYNOP, XYNOP, XYNOP, XYNOP, xy172, xy173, xy174, XYNOP
- dc.w XYNOP, XYNOP, XYNOP, XYNOP, xy180, xy181, xy182, XYNOP
- dc.w XYNOP, XYNOP, XYNOP, XYNOP, xy188, xy189, xy190, XYNOP
-
- dc.w XYNOP, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP
- dc.w XYNOP, XYNOP, XYNOP, XYCB, XYNOP, XYNOP, XYNOP, XYNOP
- dc.w XYNOP, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP
- dc.w XYNOP, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP
- dc.w XYNOP, xy225, XYNOP, xy227, XYNOP, xy229, XYNOP, XYNOP
- dc.w XYNOP, xy233, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP
- dc.w XYNOP, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP
- dc.w XYNOP, xy249, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP, XYNOP
-
-
- #define lea_a0 ;\
- move.b (ip)+,core ;\
- ext.w core ;\
- add.w ir,core ;\
- movea.l core,a0
-
-
- // ----- Handle instructions, which don't use the prefix at all but behave as normal instead (G.Lunter's Z80.DOC)
- // prefix ix: overrides preceding ix/iy prefix
- // prefix iy: overrides preceding ix/iy prefix
- // prefix ED: ignores ix / iy prefix and behaves as normal
- XYNOP: do_info_illegals2
- #if EXACT_R
- subq.b #1,r // 1+1-1 = 1
- #endif
- #if exact_timing
- // nop // 4 is correct
- #endif
- subq.l #1,ip
- bra cmd_xx
-
-
- xy09: // ----- add ir,bc
- more8
- more3 // 4+8+3 = 15 T cycles
- ror.b #1,f
- move.w BC,d0
- add.w d0,ir
- roxl.b #1,f
- m_next
-
- xy25: // ----- add ir,de
- more8
- more3 // 4+8+3 = 15 T cycles
- ror.b #1,f
- move.w DE,d0
- add.w d0,ir
- roxl.b #1,f
- m_next
-
- xy33: // ----- ld ir,nn
- more8
- more2 // 4+8+2 = 14 T cycles
- move.b (ip)+,il
- move.b (ip)+,ih
- m_next
-
- #if rom_protection
- sto_ir: move.w ir,d0
- bra store_word
- #endif
-
- xy34: // ----- ld (nn),ir
- more8
- more8
- move.w (ip)+,core
- rol.w #8,core
- movea.l core,a0
- if_rom(sto_ir)
- move.b il,(a0)+
- move.b ih,(a0)
- m_next
-
- xy35: // ----- inc ir
- more6 // 4+6 = 10 T
- addq.w #1,ir
- m_next
-
- xy36: // ----- inc ih
- more4
- addq.b #1,ih
- move ccr,d0
- and.b #1,f
- and.b #0xfe,d0
- or.b d0,f
- do_info_illegals2
- m_next
-
- xy37: // ----- dec ih
- more4
- subq.b #1,ih
- move ccr,d0
- and.b #1,f
- and.b #0xfe,d0
- or.b d0,f
- do_info_illegals2
- m_next
-
- xy38: // ----- ld ih,n
- more7
- move.b (ip)+,ih
- do_info_illegals3
- m_next
-
- xy41: // ----- add ir,ir
- more8
- more3 // 15 T
- ror.b #1,f
- lsl.w ir
- roxl.b #1,f
- m_next
-
- xy42: // ----- ld ir,(nn)
- more8
- more8 // 20 T
- move.w (ip)+,core
- rol.w #8,core
- movea.l core,a0
- move.b (a0)+,il
- move.b (a0),ih
- m_next
-
- xy43: // ----- dec ir
- more6 // 10 T
- subq.w #1,ir
- m_next
-
- xy44: // ----- inc il
- more4
- addq.b #1,il
- move ccr,d0
- and.b #1,f
- and.b #0xfe,d0
- or.b d0,f
- do_info_illegals2
- m_next
-
- xy45: // ----- dec il
- more4
- subq.b #1,il
- move ccr,d0
- and.b #1,f
- and.b #0xfe,d0
- or.b d0,f
- do_info_illegals2
- m_next
-
- xy46: // ----- ld il,n
- more7
- move.b (ip)+,il
- do_info_illegals3
- m_next
-
- xy52: // ----- inc (ir+n)
- more8
- more8
- more3 // 4+8+8+3 = 23 T
- lea_a0
- bra incx
-
- xy53: // ----- dec (ir+n)
- more8
- more8
- more3 // 4+8+8+3 = 23 T
- lea_a0
- bra decx
-
- xy54: // ----- ld (ir+n),n
- more8
- more7 // 4+8+7 = 19 T
- lea_a0
- move.b (ip)+,db
- store_db
-
- xy57: // ----- add ir,sp
- more8
- more3 // 4+8+3 = 15 T
- ror.b #1,f
- move.w rp,d0
- add.w d0,ir
- roxl.b #1,f
- m_next
-
- xy68: // ----- ld b,ih
- more4
- move.b ih,RB
- do_info_illegals2
- m_next
-
- xy69: // ----- ld b,il
- more4
- move.b il,RB
- do_info_illegals2
- m_next
-
- xy70: // ----- ld b,(ir+n)
- more8
- more7 // 4+8+7 = 19 T
- lea_a0
- move.b (a0),RB
- m_next
-
- xy76: // ----- ld c,ih
- more4
- move.b ih,RC
- do_info_illegals2
- m_next
-
- xy77: // ----- ld c,il
- more4
- move.b il,RC
- do_info_illegals2
- m_next
-
- xy78: // ----- ld c,(ir+n)
- more8
- more7 // 4+8+7 = 19 T
- lea_a0
- move.b (a0),RC
- m_next
-
- xy84: // ----- ld d,ih
- more4
- move.b ih,RD
- do_info_illegals2
- m_next
-
- xy85: // ----- ld d,il
- more4
- move.b il,RD
- do_info_illegals2
- m_next
-
- xy86: // ----- ld d,(ir+n)
- more8
- more7 // 4+8+7 = 19 T
- lea_a0
- move.b (a0),RD
- m_next
-
- xy92: // ----- ld e,ih
- more4
- move.b ih,RE
- do_info_illegals2
- m_next
-
- xy93: // ----- ld e,il
- more4
- move.b il,RE
- do_info_illegals2
- m_next
-
- xy94: // ----- ld e,(ir+n)
- more8
- more7 // 4+8+7 = 19 T
- lea_a0
- move.b (a0),RE
- m_next
-
- xy96: // ----- ld ih,b
- more4
- move.b RB,ih
- do_info_illegals2
- m_next
-
- xy97: // ----- ld ih,c
- more4
- move.b RC,ih
- do_info_illegals2
- m_next
-
- xy98: // ----- ld ih,d
- more4
- move.b RD,ih
- do_info_illegals2
- m_next
-
- xy99: // ----- ld ih,e
- more4
- move.b RE,ih
- do_info_illegals2
- m_next
-
- xy100: // ----- ld ih,ih ???!???
- more4
- do_info_illegals2
- m_next
-
- xy101: // ----- ld ih,il ???!???
- bra exit_illinstr2
- // more4
- // move.b il,ih
- // do_info_illegals2
- // m_next
-
- xy102: // ----- ld h,(ir+n)
- more8
- more7 // 4+8+7 = 19 T
- lea_a0
- move.b (a0),RH
- m_next
-
- xy103: // ----- ld ih,a
- more4
- move.b a,ih
- do_info_illegals2
- m_next
-
- xy104: // ----- ld il,b
- more4
- move.b RB,il
- do_info_illegals2
- m_next
-
- xy105: // ----- ld il,c
- more4
- move.b RC,il
- do_info_illegals2
- m_next
-
- xy106: // ----- ld il,d
- more4
- move.b RD,il
- do_info_illegals2
- m_next
-
- xy107: // ----- ld il,e
- more4
- move.b RE,il
- do_info_illegals2
- m_next
-
- xy108: // ----- ld il,ih ???!???
- bra exit_illinstr2
- // more4
- // move.b ih,il
- // do_info_illegals2
- // m_next
-
- xy109: // ----- ld il,il ???!???
- more4
- do_info_illegals2
- m_next
-
- xy110: // ----- ld l,(ir+n)
- more8
- more7 // 4+8+7 = 19 T
- lea_a0
- move.b (a0),RL
- m_next
-
- xy111: // ----- ld il,a
- more4
- move.b a,il
- do_info_illegals2
- m_next
-
- xy112: move.b RB,db // ----- ld (ir+n),b
- bra.s stox
-
- xy113: move.b RC,db // ----- ld (ir+n),c
- bra.s stox
-
- xy114: move.b RD,db // ----- ld (ir+n),d
- bra.s stox
-
- xy115: move.b RE,db // ----- ld (ir+n),e
- bra.s stox
-
- xy116: move.b RH,db // ----- ld (ir+n),h
- bra.s stox
-
- xy117: move.b RL,db // ----- ld (ir+n),l
- bra.s stox
-
- xy119: move.b a,db // ----- ld (ir+n),a
- stox: more8
- more7 // 4+8+7 = 19 T
- lea_a0
- store_db
-
- xy124: // ----- ld a,ih
- more4
- move.b ih,a
- do_info_illegals2
- m_next
-
- xy125: // ----- ld a,il
- more4
- move.b il,a
- do_info_illegals2
- m_next
-
- xy126: // ----- ld a,(ir+n)
- more8
- more7 // 4+8+7 = 19 T
- lea_a0
- move.b (a0),a
- m_next
-
- // --------------------------------------------------------------------
-
- xy132: // ----- add a,ih
- more4
- add.b ih,a
- move ccr,f
- do_info_illegals2
- m_next
-
- xy133: // ----- add a,il
- more4
- add.b il,a
- move ccr,f
- do_info_illegals2
- m_next
-
- xy134: // ----- add a,(ir+n)
- more8
- more7 // 4+8+7 = 19 T
- lea_a0
- add.b (a0),a
- move ccr,f
- m_next
-
- xy140: // ----- adc a,ih
- more4
- move.b ih,d0
- lsr.b #1,f
- cmp d0,d0 // Z-Flag setzen!
- addx.b d0,a
- move ccr,f
- do_info_illegals2
- m_next
-
- xy141: // ----- adc a,il
- more4
- move.b il,d0
- lsr.b #1,f
- cmp d0,d0 // Z-Flag setzen!
- addx.b d0,a
- move ccr,f
- do_info_illegals2
- m_next
-
- xy142: // ----- adc a,(ir+n)
- more8
- more7 // 4+8+7 = 19 T
- lea_a0
- move.b (a0),d0
- lsr.b #1,f
- cmp d0,d0 // Z-Flag setzen!
- addx.b d0,a
- move ccr,f
- m_next
-
- xy148: // ----- sub a,ih
- more4
- sub.b ih,a
- move ccr,f
- do_info_illegals2
- m_next
-
- xy149: // ----- sub a,il
- more4
- sub.b il,a
- move ccr,f
- do_info_illegals2
- m_next
-
- xy150: // ----- sub a,(ir+n)
- more8
- more7 // 4+8+7 = 19 T
- lea_a0
- sub.b (a0),a
- move ccr,f
- m_next
-
- xy156: // ----- sbc a,ih
- more4
- move.b ih,d0
- lsr.b #1,f
- cmp d0,d0 // Z-Flag setzen!
- subx.b d0,a
- move ccr,f
- do_info_illegals2
- m_next
-
- xy157: // ----- sbc a,il
- more4
- move.b il,d0
- lsr.b #1,f
- cmp d0,d0 // Z-Flag setzen!
- subx.b d0,a
- move ccr,f
- do_info_illegals2
- m_next
-
- xy158: // ----- sbc a,(ir+n)
- more8
- more7 // 4+8+7 = 19 T
- lea_a0
- move.b (a0),d0
- lsr.b #1,f
- cmp d0,d0 // Z-Flag setzen!
- subx.b d0,a
- move ccr,f
- m_next
-
- xy164: // ----- and a,ih
- more4
- and.b ih,a
- move.b (logflags,a.w),f
- do_info_illegals2
- m_next
-
- xy165: // ----- and a,il
- more4
- and.b il,a
- move.b (logflags,a.w),f
- do_info_illegals2
- m_next
-
- xy166: // ----- and a,(ir+n)
- more8
- more7 // 4+8+7 = 19 T
- lea_a0
- and.b (a0),a
- move.b (logflags,a.w),f
- m_next
-
- xy172: // ----- xor a,ih
- more4
- move.b ih,d0
- eor.b d0,a
- move.b (logflags,a.w),f
- do_info_illegals2
- m_next
-
- xy173: // ----- xor a,il
- more4
- move.b il,d0
- eor.b d0,a
- move.b (logflags,a.w),f
- do_info_illegals2
- m_next
-
- xy174: // ----- xor a,(ir+n)
- more8
- more7 // 4+8+7 = 19 T
- lea_a0
- move.b (a0),d0
- eor.b d0,a
- move.b (logflags,a.w),f
- m_next
-
- xy180: // ----- or a,ih
- more4
- or.b ih,a
- move.b (logflags,a.w),f
- do_info_illegals2
- m_next
-
- xy181: // ----- or a,il
- more4
- or.b il,a
- move.b (logflags,a.w),f
- do_info_illegals2
- m_next
-
- xy182: // ----- or a,(ir+n)
- more8
- more7 // 4+8+7 = 19 T
- lea_a0
- or.b (a0),a
- move.b (logflags,a.w),f
- m_next
-
- xy188: // ----- cp a,ih
- more4
- cmp.b ih,a
- move ccr,f
- do_info_illegals2
- m_next
-
- xy189: // ----- cp a,il
- more4
- cmp.b il,a
- move ccr,f
- do_info_illegals2
- m_next
-
- xy190: // ----- cp a,(ir+n)
- more8
- more7 // 4+8+7 = 19 T
- lea_a0
- cmp.b (a0),a
- move ccr,f
- m_next
-
- // ----------------------------------------------------------------------------------
-
- xy225: // ----- pop ir
- more8
- more2 // 14 T
- move.b (rp)+,il
- move.b (rp)+,ih
- m_next
-
- xy227: // ----- ex (sp),ir
- more8
- more8
- more3 // 23 T
- move.w (rp)+,d0
- rol.w #8,d0
- move.b ih,-(rp)
- move.b il,-(rp)
- move.w d0,ir
- m_next
-
- xy229: // ----- push ir
- more8
- more3 // 15 T
- move.b ih,-(rp)
- move.b il,-(rp)
- m_next
-
- xy233: // ----- jp (ir) *NOT* jp (ir+d) !!!
- more4
- movea.l air,ip
- bra nxtirpt
- m_next
-
- xy249: // ----- ld sp,ir
- more6 // 10 T
- move.w ir,core
- movea.l core,rp
- bne nxtcmnd
- adda.l #0x00010000,rp // if rp==0 --> rp := ramend
- m_next
-
-
-